package com.bridgeintelligent.tag.webserver.schedule.service.mapper;

import com.bridgeintelligent.tag.webserver.schedule.api.pojo.DimFree;
import com.bridgeintelligent.tag.webserver.schedule.api.pojo.DimFreeQuality;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @description
 * @author: grp 2020-09-14 11:41
 **/
@Mapper
public interface DimFreeQualityMapper {

    @Select("select TOTAL from fct_p_cust_bqpjtj_summary where UPDATE_DATE = #{updateDate} and rownum = 1")
    Long countTotal(String updateDate);

    @Update("truncate table dim_free_bqzl")
    void clearQuality();

    @Select("select dim_id,dim_name,cust_amount,classify,cust_list from dim_data where DIM_LARGE_TYPE = '02'")
    List<DimFree> findDimFree();

    @Insert("insert into DIM_FREE_BQZL values (#{tagType},#{colName},#{ycPercent},#{kzPercent},#{bhdPercent}," +
            "#{total},#{updateDate})")
    int save(DimFreeQuality dimFreeQuality);
}
